// 存储药材详情信息
const state = {
    name: '', // 药品名称
    index: '', // 药材索引
    id: '', // 药材id
    eid: '' // 归档药材id
}
const getters = {

}
// 改变state状态
const mutations = {
    savemedicinal(state,{mname,mindex,mid}){
        state.name = mname;
        state.index = mindex;
        localStorage.setItem("id",mid);
        state.id = mid;
        localStorage.setItem("index",mindex);
    },
    saveMid(state,mid) {
        state.id = mid;
        localStorage.setItem("id",mid);
    },
    saveEditionMid(state,mid) {
        state.eid = mid;
        localStorage.setItem("eid",mid);
    },
}
const actions = {
    addmedicinal(context,{mname,mindex,mid}){
        context.commit('savemedicinal',{mname,mindex,mid})
    },
    addMid(context,mid) {
        context.commit('saveMid',mid);
    },
    addEditionMid(context,mid) {
        context.commit('saveEditionMid',mid);
    }
}


export default {
    state,
    getters,
    mutations,
    actions
}